#include "mainhdv.h"
#include <QPushButton>
#include <QVBoxLayout>

MainHDV::MainHDV(QWidget *parent)
    : QWidget(parent)
{
    startButton = new QPushButton(tr("Start"));
    connect(startButton,SIGNAL(clicked()),SLOT(onStartButtonClicked()));
    mainLayout = new QVBoxLayout;
    mainLayout->addWidget(startButton);
    this->setLayout(mainLayout);
}

MainHDV::~MainHDV()
{
    
}

void MainHDV::onStartButtonClicked()
{
    //TODO
    deckLinkIterator = CreateDeckLinkIteratorInstance();

    if (!deckLinkIterator)
    {
        fprintf(stderr, "This application requires the DeckLink drivers installed.\n");
        //No DeckLink driver installed
        return;
    }
    result = deckLinkIterator->Next(&decklink1);
    if(result != S_OK)
    {
        fprintf(stderr, "No DeckLink PCI cards found.\n");
    }
    camera1 = new HDCamera(decklink1, "cam1");
    result = deckLinkIterator->Next(&decklink2);
    if(result != S_OK)
    {
        fprintf(stderr, "No DeckLink PCI cards found.\n");
    }
    camera2 = new HDCamera(decklink2, "cam2");
}
